package cn.itsource.controller.system;





import cn.itsource.service.system.imp.LogininfoService;
import cn.itsource.system.domain.LoginDto;
import cn.itsource.utils.BusinessException;
import cn.itsource.utils.JsonResult;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/login")
public class LogininfoController {
    @Autowired
    private LogininfoService loginService;

    @PostMapping("/account")
    public JsonResult accountLogin(@RequestBody LoginDto loginDto){
        try {
            String jwtToken = loginService.accountLogin(loginDto);
            return JsonResult.success(jwtToken);
        } catch (BusinessException e) {
            return JsonResult.error(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return JsonResult.error("系统内部异常");
        }
    }















}
